﻿using System;
using Microsoft.Xna.Framework;
using Terraria.Graphics.Shaders;

namespace Terraria.Graphics.Effects
{
	// Token: 0x02000396 RID: 918
	public class Filter : GameEffect
	{
		// Token: 0x06002069 RID: 8297 RVA: 0x00016CCD File Offset: 0x00014ECD
		public Filter(ScreenShaderData shader, EffectPriority priority = EffectPriority.VeryLow)
		{
			this._shader = shader;
			this._priority = priority;
		}

		// Token: 0x0600206A RID: 8298 RVA: 0x00016CE3 File Offset: 0x00014EE3
		public void Update(GameTime gameTime)
		{
			this._shader.UseGlobalOpacity(this.Opacity);
			this._shader.Update(gameTime);
		}

		// Token: 0x0600206B RID: 8299 RVA: 0x00016D03 File Offset: 0x00014F03
		public void Apply()
		{
			this._shader.Apply();
		}

		// Token: 0x0600206C RID: 8300 RVA: 0x00016D10 File Offset: 0x00014F10
		public ScreenShaderData GetShader()
		{
			return this._shader;
		}

		// Token: 0x0600206D RID: 8301 RVA: 0x00016D18 File Offset: 0x00014F18
		public override void Activate(Vector2 position, params object[] args)
		{
			this._shader.UseGlobalOpacity(this.Opacity);
			this._shader.UseTargetPosition(position);
			this.Active = true;
		}

		// Token: 0x0600206E RID: 8302 RVA: 0x00016D40 File Offset: 0x00014F40
		public override void Deactivate(params object[] args)
		{
			this.Active = false;
		}

		// Token: 0x0600206F RID: 8303 RVA: 0x00016D49 File Offset: 0x00014F49
		public bool IsInUse()
		{
			return this.Active || this.Opacity != 0f;
		}

		// Token: 0x06002070 RID: 8304 RVA: 0x00016D65 File Offset: 0x00014F65
		public bool IsActive()
		{
			return this.Active;
		}

		// Token: 0x06002071 RID: 8305 RVA: 0x00016D6D File Offset: 0x00014F6D
		public override bool IsVisible()
		{
			return this.GetShader().CombinedOpacity > 0f && !this.IsHidden;
		}

		// Token: 0x04003D03 RID: 15619
		public bool Active;

		// Token: 0x04003D04 RID: 15620
		private ScreenShaderData _shader;

		// Token: 0x04003D05 RID: 15621
		public bool IsHidden;
	}
}
